package com.demo.controller;

// 测试Bean的作用域

// 用户A进行修改name

import com.demo.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class BeanScopesControllerA {
    // 属性注入Bean对象
    @Autowired
    private User userZ;

    // 写一个方法修改并获取userZ
    public User getUserZ() {
        User userA = userZ;
        System.out.println("A用户修改之前："+userA);
        // 对name属性进行修改
        userA.setName("小蔡");
        System.out.println("A用户修改name之后：");
        return userA;
    }
}
